package xmltest;

import org.xml.sax.*;
import javax.xml.parsers.*;
import java.io.*;

/**
 *
 * @author Randy
 */
public class xmlTest {
    private SAXParserFactory factory;
    private xmlHandler handler;
    private SAXAfdeling afdeling;
    private SAXHHS hhs;

    public xmlTest() throws Exception {
        handler = new xmlHandler();
  
            factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();
            File file = new File("C:/vrije minor/svn/wiinf/trunk/Java/XML/HHS.xml");
            saxParser.parse(file, handler);
            afdeling = handler.getAfdeling();
            hhs = handler.getHHS();

            for(int i =0; i < hhs.getAfdelingSize(); i++) {
                SAXAfdeling afdeling = hhs.getAfdeling(i);
                System.out.println(afdeling.getAfdNaam());
                for (int j = 0; j < afdeling.getOpleidingSize(); j++) {
                    SAXOpleiding opleiding = afdeling.getOpleiding(j);
                    System.out.println(opleiding);
                }
            }
    }

    public static void main(String[] args) throws Exception {
        new xmlTest();
    }
}
